﻿Imports Telerik.Web.UI


Partial Class VoucherGENERALHdr
    Inherits System.Web.UI.Page

    Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
        Me.Theme = GetGlobalResourceObject("SystemResource", "Theme")
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Dim _lblPageTitle As Label
            _lblPageTitle = Me.Master.FindControl("lblPageTitle")
            _lblPageTitle.Text = GetLocalResourceObject("PageTitle")
        End If
    End Sub


    Protected Sub rgVoucher_ItemCommand(sender As Object, e As Telerik.Web.UI.GridCommandEventArgs) Handles rgVoucher.ItemCommand
        If rgVoucher.SelectedItems.Count > 0 Then
            'access a string value
            hdnVoucherID.Value = rgVoucher.SelectedValues("ID").ToString()
        End If

        If TypeOf e.Item Is GridDataItem Then
            Dim dataItem As GridDataItem = CType(e.Item, GridDataItem)
            hdnVoucherID.Value = dataItem.GetDataKeyValue("ID").ToString
        End If
        If e.CommandName = "Add" Then
            e.Canceled = True
            Response.Redirect("VoucherGENERALDtl.aspx?VoucherID=")
        ElseIf (e.CommandName = RadGrid.EditCommandName) Then
            Response.Redirect(String.Format("VoucherGENERALDtl.aspx?VoucherID={0}", hdnVoucherID.Value))
        End If
    End Sub

End Class

